using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;

namespace Mystery.SharePoint.Features.StandardGroups
{
    /// <summary>
    /// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
    /// </summary>
    /// <remarks>
    /// The GUID attached to this class may be used during packaging and should not be modified.
    /// </remarks>

    [Guid("5c185729-fa1a-412c-be5c-1bc1d9d5ee12")]
    public class StandardGroupsEventReceiver : SPFeatureReceiver
    {
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            Logger.L.AddInformation(Category.Administration, "Creating standard groups for {0}", site.Url);
            site.RootWeb.CreateDefaultAssociatedGroups(site.Owner.LoginName, "", site.RootWeb.Title);
        }
    }
}
